package www.xpu.edu.app;

import android.content.Intent;
import android.drm.DrmStore;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //取消标题栏
       ActionBar actionbar=getSupportActionBar();
        if(actionbar!=null)
        {
             actionbar.hide();
        }
        //注册reg
        //登录login

        Button button_reg=(Button)findViewById(R.id.main_b1);
        Button button_login=(Button)findViewById(R.id.main_b2);
        button_reg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               //测试:此代码块的作用是获取全局变量num
               /* myapplication=(Myapplication)getApplication();
                Toast.makeText(MainActivity.this,myapplication.getNum(),Toast.LENGTH_LONG).show();*/
               // myapplication.setNum("19829081234");
                //Toast.makeText(MainActivity.this,myapplication.getNum(),Toast.LENGTH_LONG).show();
                 /*Myapplication myapplication=(Myapplication)getApplication();
                 Toast.makeText(MainActivity.this,myapplication.getNum(),Toast.LENGTH_LONG).show();*/
                Toast.makeText(MainActivity.this,"点击了注册按钮",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(MainActivity.this,Activity_reg.class));

            }
        });
        button_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,"点击了登录按钮",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(MainActivity.this,Activity_login.class));
            }
        });

    }
}
